package com.netflexitysolutions.amazonws.sdb;

import java.util.Iterator;
import java.util.List;

import com.amazonaws.sdb.doc._2009_04_15.AmazonSDBPortType;

public interface SimpleDB {

	/**
	 * @param domainName
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract Domain createDomain(String domainName)
			throws SimpleDBException;

	/**
	 * @param domainName
	 * @param callback
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract Domain createDomain(String domainName,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param domain
	 * @throws SimpleDBException
	 */
	public abstract void deleteDomain(Domain domain) throws SimpleDBException;

	/**
	 * @param domain
	 * @param callback
	 * @throws SimpleDBException
	 */
	public abstract void deleteDomain(Domain domain, ResponseCallback callback)
			throws SimpleDBException;

	/**
	 * Return domain iterator for this account.
	 * 
	 * @param callback
	 */
	public abstract Iterator<List<Domain>> getDomains(ResponseCallback callback)
			throws SimpleDBException;

	/**
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract Iterator<List<Domain>> getDomains()
			throws SimpleDBException;

	/**
	 * Return item iterator based on select query results.
	 * 
	 * @param query
	 * @param callback
	 * @return
	 */
	public abstract Iterator<List<Item>> select(String query,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param query
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract Iterator<List<Item>> select(String query)
			throws SimpleDBException;

	/**
	 * @param domain
	 * @param item
	 * @param callback
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract Item getItem(Domain domain, Item item,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param domain
	 * @param item
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract Item getItem(Domain domain, Item item)
			throws SimpleDBException;

	/**
	 * @param domain
	 * @param item
	 * @param callback
	 * @throws SimpleDBException
	 */
	public abstract void addOrUpdateItem(Domain domain, Item item,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param domain
	 * @param item
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract void addOrUpdateItem(Domain domain, Item item)
			throws SimpleDBException;

	/**
	 * @param domain
	 * @param items
	 * @param callback
	 * @throws SimpleDBException
	 */
	public abstract void addOrUpdateItems(Domain domain, List<Item> items,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param domain
	 * @param item
	 * @param callback
	 * @throws SimpleDBException
	 */
	public abstract void deleteItem(Domain domain, Item item,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param domain
	 * @param item
	 * @throws SimpleDBException
	 */
	public abstract void deleteItem(Domain domain, Item item)
			throws SimpleDBException;

	/**
	 * @param domain
	 * @param callback
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract DomainMetadata getDomainMetadata(Domain domain,
			ResponseCallback callback) throws SimpleDBException;

	/**
	 * @param domain
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract DomainMetadata getDomainMetadata(Domain domain)
			throws SimpleDBException;

	/**
	 * @param domain
	 * @param items
	 * @return
	 * @throws SimpleDBException
	 */
	public abstract void addOrUpdateItems(Domain domain, List<Item> items)
			throws SimpleDBException;

	/**
	 * @return the service
	 */
	public abstract AmazonSDBPortType getService();

}